/**
 * 
 */
package org.cuatrovientos.struts.tulebox.example;

import java.util.Random;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author VB
 *
 */
public class Attributes extends ActionSupport{
	private int intelligence=0;
	private int strength=0;
	private int dexterity=0;
	private String result="";
	public int getIntelligence() {
		return intelligence;
	}
	public void setIntelligence(int intelligence) {
		this.intelligence = intelligence;
	}
	public int getStrength() {
		return strength;
	}
	public void setStrength(int strength) {
		this.strength = strength;
	}
	public int getDexterity() {
		return dexterity;
	}
	public void setDexterity(int dexterity) {
		this.dexterity = dexterity;
	}



	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	@Override
	
	/**
	 * Returns a message depending on the total of the attributes (right/wrong)
	 */
	public String execute()
	{
		if ((dexterity + strength + intelligence)==30){
			result = getText("RightAttributes.message");
			return SUCCESS;
		}else{
			result = getText("WrongAttributes.message");
			return ERROR;
		}

	}


}
